package com.longge;

import java.util.Arrays;

public class NumberGame {

    public int[] numberGame(int[] nums) {

        Arrays.sort(nums);
        int[] ans = new int[nums.length];
        int i = 0;
        while (i < nums.length - 1) {
            ans[i] = nums[i + 1];
            ans[i + 1] = nums[i];
            i += 2;
        }
        return ans;

    }
}
